// The relationship between "this" and "virtual".

#include <iostream>
#include <cstring>
using namespace std;

class Base {
	public:
		Base( ){ 
			cout << "Base::" ;
			this->vfun( );
		}
		~Base( ){ 
			cout << "~Base::" ;
			this->vfun( );
		}
		void foo( /* Base this */ ){
			cout << "foo::" ;
			this->vfun( );
		}
		virtual void vfun( ) { cout << "Base::vfoo" << endl; }
};

class Derived : public Base {
	public:
		void vfun( ) { cout << "Derived::vfun" << endl; }
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) { 
	Derived d;
	d.foo( );	// foo( &d );

	return 0;
}

